import 'package:dustbin_sort/pages/dustbin_index_danger.dart';
import 'package:dustbin_sort/pages/dustbin_index_dry.dart';
import 'package:dustbin_sort/pages/dustbin_index_recycle.dart';
import 'package:dustbin_sort/pages/dustbin_index_wet.dart';
import 'package:dustbin_sort/pages/select_page.dart';
import 'package:dustbin_sort/util/navigator_util.dart';
import 'package:dustbin_sort/widget/message_dialog.dart';
import 'package:flutter/material.dart';

class SearchPage extends StatefulWidget
{
	@override
	State<StatefulWidget> createState()=>_SearchPageState();

}
class _SearchPageState extends State<SearchPage>
{

	final PageController _controller = PageController(
		initialPage: 1,
	);
	@override
	Widget build(BuildContext context) {
		// TODO: implement build
		return Scaffold(
			appBar: AppBar(
				title: Text(
					"垃圾分类",
					style: TextStyle(color: Colors.black,fontWeight: FontWeight.w300,),
				),
				elevation: 0,
				backgroundColor: Colors.white,
			),
			body: Stack(
				children: <Widget>[
						MediaQuery.removePadding(
						removeTop: true,
						context: context,
							child: ListView(
								children: <Widget>[
									Container(
										height: 40,
										margin: EdgeInsets.all(12),
										padding: EdgeInsets.fromLTRB(7, 7, 7, 7),

										decoration: BoxDecoration(
											border: new Border.all(style: BorderStyle.solid, color: Colors.black12),
											borderRadius: BorderRadius.circular(20),
											color: Colors.white
										),
										child: TextField(
												cursorColor: Colors.blue,
												onTap: () async{
													print("tap the textfield");
													NavigatorUtil.push(context, SelectPage());
												},
												scrollPadding: EdgeInsets.only(left: 10),
												decoration: InputDecoration(
														border: InputBorder.none,
														suffixIcon: Icon(Icons.search, color: Colors.blue,),
														focusedBorder: UnderlineInputBorder(
																borderSide: BorderSide(color: Colors.transparent)
														)
												),
											),
									),
									Container(
										height: 500,
										padding: EdgeInsets.all(0),
										color: Colors.white,
									),

								],
							)
						),
						GestureDetector(
							child: Container(
									margin: EdgeInsets.only(top: 100),
									height: 140,
									child: Container(
										padding: EdgeInsets.only(left: 40,top: 40),
										width: MediaQuery.of(context).size.width,
										child: Text("湿垃圾", style: TextStyle(fontSize: 20, color: Colors.white),),
									),
									decoration: BoxDecoration(
										color: Color.fromARGB(255, 230, 208, 109),
										borderRadius: BorderRadius.only(topLeft: Radius.circular(40)),
										image:DecorationImage(

											alignment: Alignment.centerRight,
											image: new AssetImage('assets/images/fishbone.png',),

										),
									)
							),
							onTap: (){
								NavigatorUtil.push(context, DustbinIndexWet());
							},
						),
					  GestureDetector(
							child: Container(
									margin: EdgeInsets.only(top: 200),
									height: 140,

									child: Container(
										padding: EdgeInsets.only(left: 40,top: 40),
										width: MediaQuery.of(context).size.width,
										child: Text("可回收垃圾", style: TextStyle(fontSize: 20, color: Colors.white),),
									),
									decoration: BoxDecoration(
											image:DecorationImage(

												alignment: Alignment.centerRight,
												image: new AssetImage('assets/images/recycle.png',),

											),
											color: Colors.blue,
											borderRadius: BorderRadius.only(topLeft: Radius.circular(40))
									)
							),
							onTap: (){
								NavigatorUtil.push(context, DustbinIndexRecycle());
							},
						),
						GestureDetector(
							child: Container(
									margin: EdgeInsets.only(top: 300),
									height: 140,
									child: Container(
										padding: EdgeInsets.only(left: 40,top: 40),
										width: MediaQuery.of(context).size.width,
										child: Text("有害垃圾", style: TextStyle(fontSize: 20, color: Colors.white),),
									),
									decoration: BoxDecoration(
											image:DecorationImage(

												alignment: Alignment.centerRight,
												image: new AssetImage('assets/images/danger.png',),

											),
											color: Colors.deepPurpleAccent,
											borderRadius: BorderRadius.only(topLeft: Radius.circular(40))
									)
							),
							onTap: (){
								NavigatorUtil.push(context, DustbinIndexDanger());
							},
						),
						GestureDetector(
							child: Container(
									margin: EdgeInsets.only(top: 400),
									height: 140,
									child: Container(
										padding: EdgeInsets.only(left: 40,top: 40),
										width: MediaQuery.of(context).size.width,
										child:Text("干垃圾", style: TextStyle(fontSize: 20, color: Colors.white),),
									),
									decoration: BoxDecoration(
											image:DecorationImage(
													alignment: Alignment.centerRight,
													image: new AssetImage('assets/images/dry.png')
											),
											color: Color.fromARGB(255, 6, 11, 44),
											borderRadius: BorderRadius.only(topLeft: Radius.circular(40))
									)
							),
							onTap: (){
								NavigatorUtil.push(context, DustbinIndexDry());
							},
						),
						Container(
								margin: EdgeInsets.only(top: 500),
								height: 100,
								decoration: BoxDecoration(
										color: Colors.white,
										borderRadius: BorderRadius.only(topLeft: Radius.circular(40))
								)
						),

				],
			),
		);
	}


}